<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
      function share(money, n) {
            var rand  = 0
                if(money<n*0.01){
                    return []
                }
//     else if(typeof(money)!="number"){
//                 return []
//                 }
                var shares = []
                var oneShare =0
                if(n==1){
                    return [money]
                }
                var maxrand = money-(n-1)*0.01
//                 while(rand<0.01/n){
//                    rand = Math.random() 
//                 }
                
                oneShare = Math.ceil(maxrand*Math.random() *100)/100
//                 oneShare = oneShare.toFixed(2))
                shares.push(oneShare)
                if(n>1){var othershare = share(money - oneShare+(n-1)*0.01,n-1)
                        shares = shares.concat(othershare)
                }
                return shares            
            }
            // function share1(money,n){
            //     if(money<n*0.01){
            //         return []
            //     }else if(typeof(money)!="number"){
            //     return []
            //     }
            //     var cents = 100*money
            //     var nowcents = 
            // }

           console.log(share(0.06, 5))
    </script>
</body>
</html>